/*
 * 合作伙伴列表
 * @Author: ljb 
 * @Date: 2017-11-27 15:24:15 
 * @Last Modified by: ljb
 * @Last Modified time: 2018-01-27 16:04:09
 */
<style lang="less" rel="stylesheet/less" type="text/less" scoped>

</style>
<template>
<div class="v-admin-partner-index">

    <Table border :columns="columns" :loading="loading" :data="partners"></Table>

</div>
</template>

<script>

import Button from 'iview/src/components/button';
import Icon from 'iview/src/components/icon';

export default {
    name: 'partner-index',
    props: ['loading','partners'],
    data() {	
        return {
            columns: [
                {
                    type: 'selection',
                    width: 60,
                    align: 'center'
                },
                {
                    title: '名称',
                    key: 'name',
                    align: 'center',
                    render: (h,{row}) => {
                        return <div> { row.name || '-' } </div>
                    }
                },
                {
                    title: 'logo预览图',
                    key: 'logo',
                    align: 'center',
                    render: (h,{row}) => {
                        return <div>
                            {   
                                row.logo
                                ? <img src={ row.logo } alt="无" width="50%"/>
                                : '无' 
                            }
                        </div>
                    }
                },
                // {
                //     title: '网址',
                //     key: 'url',
                //     align: 'center',
                //     render: (h,{row}) => {
                //         return <div> { row.url || '-' } </div>
                //     }
                // },
                {
                    title: '优先级',
                    key: 'priority',
                    align: 'center',
                    render: (h,{row}) => {
                        return <div> { row.priority || '-' } </div>
                    }
                },
                {
                    title: '备注',
                    key: 'remark',
                    align: 'center',
                    render: (h,{row}) => {
                        return <div> { row.remark || '-' } </div>
                    }
                },
                {
                    title: '创建时间',
                    key: 'created_at',
                    width: 200,                 
                    align: 'center',
                    render: (h,{row}) => {
                        return <div> { !row.created_at ? '-': row.created_at  } </div>
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    width: 200,
                    render: (h, {row}) => {
                        return (
                            <div>
                                <Button size="small" style={{ marginRight: '5px' }} on-click={() => {this.$emit('edit',row.id)}} type="primary">修改信息</Button>
                                <Button size="small" on-click={() => {this.$emit('delete',row.id)}} type="error">删除伙伴</Button>
                            </div>)
                    }
                }
            ]
        }
    },
    methods: {
        
    }
}
</script>